package com.yangjie.common.syslog;

import java.util.Locale;
import java.util.Properties;

import javax.inject.Inject;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.stereotype.Component;


public class LogMessageProvider {
	ReloadableResourceBundleMessageSource messageSource = null;
	private String language = null;
	private Locale locale = null;

	public void setMessageSource(ReloadableResourceBundleMessageSource messageSource) {
		this.messageSource = messageSource;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
		locale = new Locale(language);
	}

	public String getMessage(String code) {
		return messageSource.getMessage(code, null, locale);
	}

	public String getMessage(String code, Object[] args) {
		return messageSource.getMessage(code, args, locale);
	}
}
